package com.ry.bhwktapp.home.testkt

class WhenTest {

    fun ww(){
         var kk  = 2;
        when(kk){
            1 -> print("1")
            2 -> print("2")
            else -> print("else")
        }

        val result = when (kk) {
            1 -> "1"
            2 -> "2"
            else -> 5
        }


        when(kk){
            1,2-> print("1&&2")
            else -> print("else")
        }


        when(kk){
            1,2-> print("1&&2")
            else -> print("else")
        }


        when(kk){
            hh(kk)-> print("1&&2")
            else -> print("else")
        }

        when(kk){
            in 1..10-> print("在1-10范围内")
            !in 2..20-> print("不在2-20范围内")
            else -> print("else")
        }

    }

    fun hh(kk:Int):Int{
        return kk*2
    }





}